// 默认键
const KEY = 'haozu-token'

const CITY = 'haozu-CITY'
// 写入存储
export const setToken = data => localStorage.setItem(KEY, data)

// 读取存储
export const getToken = () => localStorage.getItem(KEY)

// 删除存储
export const delToken = () => localStorage.removeItem(KEY)

// 写入默认
export const setCity = data => localStorage.setItem(CITY, JSON.stringify(data))

// 读取默认
export const getCity = () => {
  if (localStorage.getItem(CITY)) {
    return JSON.parse(localStorage.getItem(CITY))
  } else {
    return {
      label: '北京',
      value: 'AREA|88cff55c-aaa4-e2e0'
    }
  }
}

// 删除默认
export const delCity = () => localStorage.removeItem(CITY)
